<%@page import="com.baozun.util.StringUtil"%>
<%@page import="com.baozun.model.TUser"%>
<%@page import="com.baozun.util.items.SelectSet"%>
<%@page import="com.baozun.util.CommonConst"%>
<%@page import="com.baozun.model.TUserInfo"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta name="description" content="Common form elements and layouts" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<!-- basic styles -->

<link href="../assets/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="../assets/css/font-awesome.min.css" />

<!--[if IE 7]>
		  <link rel="stylesheet" href="../assets/css/font-awesome-ie7.min.css" />
		<![endif]-->

<!-- page specific plugin styles -->

<link rel="stylesheet"
	href="../assets/css/jquery-ui-1.10.3.custom.min.css" />
<link rel="stylesheet" href="../assets/css/chosen.css" />
<link rel="stylesheet" href="../assets/css/datepicker.css" />
<link rel="stylesheet" href="../assets/css/bootstrap-timepicker.css" />
<link rel="stylesheet" href="../assets/css/daterangepicker.css" />
<link rel="stylesheet" href="../assets/css/colorpicker.css" />

<!-- fonts -->

<!-- link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,300" /-->
<link rel="stylesheet" href="../assets/css/font.css" />

<!-- ace styles -->

<link rel="stylesheet" href="../assets/css/ace.min.css" />
<link rel="stylesheet" href="../assets/css/ace-rtl.min.css" />
<link rel="stylesheet" href="../assets/css/ace-skins.min.css" />

<!--[if lte IE 8]>
		  <link rel="stylesheet" href="../assets/css/ace-ie.min.css" />
		<![endif]-->

<!-- inline styles related to this page -->

<!-- ace settings handler -->
<style>
	.header{
	
	margin-top:2px;
	}
</style>
<script src="../assets/js/ace-extra.min.js"></script>
</head>
<%
TUser user = (TUser)session.getAttribute(CommonConst.SESSION_USER);
TUserInfo userInfo = (TUserInfo)request.getAttribute(CommonConst.REQUEST_USER_INFO);
%>
<body onload="IFrameResize()">
	<div class="page-content">
		<div class="page-header">
			<h1>
				个人详细信息 
			</h1>
		</div>
		<!-- /.page-header -->

		<div class="row">
			<div class="col-xs-13">
				<!-- PAGE CONTENT BEGINS -->
				<form class="form-horizontal" role="form" name="user_info_detail_form" method="post">
					<input type="hidden" id="stUserId" name="stUserId" value="<%=user.getStUserId()%>"/>
					<div class="form-group">
						<label class="col-sm-1 control-label no-padding-right"
							for="form-field-1"> 头像 </label>
						<div class="col-sm-9">
							<img src="<%=userInfo.getStPhotoAddress()%>" alt="" />
							<input type="file"/>
						</div>
					</div>

					<div class="space-4"></div>
					
					<div class="form-group">
						<label class="col-sm-1 control-label no-padding-right"
							for="form-field-1"> 曾用名 </label>
						<div class="col-sm-9">
							<input type="text" id="stUsedName" name="stUsedName" class="col-xs-5 col-sm-5" value="<%=StringUtil.param2Html(userInfo.getStUsedName())%>"/>
						</div>
					</div>

					<div class="space-4"></div>
					
					<div class="form-group">
						<label class="col-sm-1 control-label no-padding-right"
							for="form-field-1"> 英文名 </label>
						<div class="col-sm-9">
							<input type="text" id="stEnglishName" name="stEnglishName" class="col-xs-5 col-sm-5" value="<%=StringUtil.param2Html(userInfo.getStEnglishName())%>"/>
						</div>
					</div>
					<div class="space-4"></div>
					<div class="form-group">
						<label class="col-sm-1 control-label no-padding-right"
							for="form-field-1"> 地址 </label>
						<div class="col-sm-9">
							<input type="text" id="stAddress" name="stAddress" class="col-xs-5 col-sm-5" value="<%=StringUtil.param2Html(userInfo.getStAddress())%>"/>
						</div>
					</div>

					<div class="space-4"></div>

					<div class="form-group">
						<label class="col-sm-1 control-label no-padding-right"
							for="form-field-1"> 是否公开 </label>
						<div class="col-sm-9">
							<select id="stIsOpen" name="stIsOpen" class="col-xs-5">
								<option value="">请选择...</option>
								<%SelectSet.outputOptions(SelectSet.getYesOrNo(),out,userInfo.getStIsOpen());%>
							</select>
						</div>
					</div>
					
					<div class="space-4"></div>
					
					<div class="form-group">
						<label class="col-sm-1 control-label no-padding-right"
							for="form-field-1"> 座右铭 </label>
						<div class="col-sm-9">
							<textarea  class="col-xs-5 col-sm-5" rows="" cols="" id="stMotto" name="stMotto"><%=StringUtil.param2Html(userInfo.getStMotto())%></textarea>
						</div>
					</div>
					
					<div class="space-4"></div>
					
					<div class="form-group">
						<label class="col-sm-1 control-label no-padding-right"
							for="form-field-4">个人介绍</label>

						<div class="col-sm-9">
								<textarea id="editor" style="height: 500px;width: 700px;"><%=StringUtil.param2Html(userInfo.getClUserIntroduce())%></textarea>
								<input type="hidden" id="clUserIntroduce" name="clUserIntroduce" value=""/>
								<div class="hr hr-double dotted"></div>
						</div>
					</div>
					
				</form>
				<div class="form-actions" style="padding-left: 30%;">
					<button onclick="userInfoUpdateSubmit()" class="btn btn-sm btn-success">保存</button>
					<button class="btn btn-sm btn-danger" onclick="cancel()">取消</button></div>
				<!-- PAGE CONTENT ENDS -->
			</div>
			
			<!-- /.col -->
		</div>
		<!-- /.row -->
	</div>
	<!-- /.page-content -->

		<!-- page specific plugin scripts -->

		<!--[if lte IE 8]>
		  <script src="assets/js/excanvas.min.js"></script>
		<![endif]-->
	<script type="text/javascript" src="../assets/js/jquery-2.0.3.min.js"></script>
	<script src="../assets/js/bootstrap.min.js"></script>
	<script src="../assets/js/typeahead-bs2.min.js"></script>

		<!-- page specific plugin scripts -->

	<script src="../assets/js/jquery-ui-1.10.3.custom.min.js"></script>
	<script src="../assets/js/jquery.ui.touch-punch.min.js"></script>
	<script src="../assets/js/markdown/markdown.min.js"></script>
	<script src="../assets/js/markdown/bootstrap-markdown.min.js"></script>
	<script src="../assets/js/jquery.hotkeys.min.js"></script>
	<script src="../assets/js/bootbox.min.js"></script>
	<script src="../assets/js/ace-elements.min.js"></script>
	<script src="../assets/js/ace.min.js"></script>
	
	<!-- 副文本编辑器 -->
	<script src="../kindeditor-4.1.10/kindeditor.js"></script>
	<script src="../kindeditor-4.1.10/lang/zh_CN.js"></script>
	<script src="../kindeditor-4.1.10/plugins/code/prettify.js"></script>
	
	<!-- artDialog插件 -->
	<script type="text/javascript" src="../js/artDialog/artDialog.source.js?skin=default"></script>
	<script type="text/javascript" src="../js/artDialog/plugins/iframeTools.source.js"></script>
	<script type="text/javascript" src="../js/openDialog.js"></script>
	<script type="text/javascript" src="../js/openDialogcustom.js"></script>
	
	<script type="text/javascript">
	jQuery(function($){
		var userid = $("#stUserId").val();
		KindEditor.ready(function(K) {
	        window.editor = K.create('#editor', {
					cssPath : '../kindeditor-4.1.10/plugins/code/prettify.css',
					uploadJson : '../kindeditor-4.1.10/jsp/upload_json.jsp?path=user/photo/'+userid+'/',
					fileManagerJson : '../kindeditor-4.1.10/jsp/file_manager_json.jsp',
					allowFileManager : true,
					afterCreate : function() {
						var self = this;
						K.ctrl(document, 13, function() {
							self.sync();
							document.forms['user_info_detail_form'].submit();
						});
						K.ctrl(self.edit.doc, 13, function() {
							self.sync();
							document.forms['user_info_detail_form'].submit();
						});
					}
				});
	    });
		
		prettyPrint();
		
		window.iframeResize = function(){  
	        var  dvalue = 0;
	       // if($.browser.safari){  
	       //     dvalue = 67; 
	       // }  
	        parent.document.getElementById("user_info_detail_iframe").scrolling = "no";  
	        parent.document.getElementById("user_info_detail_iframe").height = "";  
	        parent.document.getElementById("user_info_detail_iframe").style.height = "";  
	        parent.document.getElementById("user_info_detail_iframe").height = document.body.scrollHeight + dvalue;  
	      };
	      if(window.iframeResize){  
	          window.iframeResize();
	      }
	      parent.iFrameHeight();
	});

	//修改保存
 function userInfoUpdateSubmit(){
	 $.ajax({
		 url:"user_info_update_submit.do",
		 data:{nmAge:$("#nmAge").val(),stSex:$("#stSex").val(),stFavourite:$("#stFavourite").val(),stQq:$("#stQq").val()},
		 dataType:"text",
		 type:"post",
		 success:function(data,status){
			 if("right" == data){
				 alert("修改成功");
			 }
		 },
		 error:function(data){
			 alert("修改失败");
		 }
	 });
 }
 
 //取消编辑 
 function cancel(){
	 history.back();
 }
	</script>
</body>
</html>